package com.dragon.modules.yuegou.model.park;

import com.dragon.modules.yuegou.entity.park.RecordEntity;
import com.dragon.modules.yuegou.enums.ParkSystem;
import com.dragon.modules.yuegou.enums.park.RecordStatus;
import com.dragon.modules.yuegou.utils.PrivateStringUtils;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 停车记录表模型类
 * 
 * @author px
 * @date 2019-04-19 10:16:19
 * @company sgy
 * @version 2.0
 * @see Length 长度限制
 * @see NotNull 对象非空
 * @see NotEmpty 字符串、集合、表、数组非空
 */
public class Record extends RecordEntity {

	/** 停车时长（秒） */
	@ApiModelProperty("停车时长（秒）")
	private Integer stayedTime;
	
	/** 停车场名称 */
	@ApiModelProperty("停车场名称")
	private String parkingName;
	
	/** 上一次支付时间 */
	@ApiModelProperty("上一次支付时间")
	private LocalDateTime lastPayTime;

	/** [枚举]：1-仅用卷-VOLUME、2-仅用积分-INTEGRAL、3-卷和积分-VOLUME_INTEGRAL */
	@ApiModelProperty("[枚举]抵扣方式：1-仅用卷-VOLUME、2-仅用积分-INTEGRAL、3-卷和积分-VOLUME_INTEGRAL、4-卷和积分二选一-COUPON_OR_POINT")
	private Integer deductionType;

	@ApiModelProperty("我的积分")
	private Integer myIntegral;

	@ApiModelProperty("type:0：正常抵扣，1：积分不足，2：今日抵扣次数已达上限")
	private Integer type;

	@ApiModelProperty("抵扣规则")
	private DeductionRule deductionRule;

	@ApiModelProperty("默认使用 0 券 1 积分")
	private Integer defaultUse;


	public DeductionRule getDeductionRule() {
		return deductionRule;
	}

	public void setDeductionRule(DeductionRule deductionRule) {
		this.deductionRule = deductionRule;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Integer getMyIntegral() {
		return myIntegral;
	}

	public void setMyIntegral(Integer myIntegral) {
		this.myIntegral = myIntegral;
	}

	public Integer getDeductionType() {
		return deductionType;
	}

	public void setDeductionType(Integer deductionType) {
		this.deductionType = deductionType;
	}

	public Integer getDefaultUse() {
		return defaultUse;
	}

	public void setDefaultUse(Integer defaultUse) {
		this.defaultUse = defaultUse;
	}

	public Integer getStayedTime() {
		return stayedTime;
	}

	public void setStayedTime(Integer stayedTime) {
		this.stayedTime = stayedTime;
	}

	public String getParkingName() {
		return parkingName;
	}

	public void setParkingName(String parkingName) {
		this.parkingName = parkingName;
	}

	public LocalDateTime getLastPayTime() {
		return lastPayTime;
	}

	public void setLastPayTime(LocalDateTime lastPayTime) {
		this.lastPayTime = lastPayTime;
	}

	/**
	 * 构造一个空停车记录表模型对象
	 */
	public Record(){
		super();
	}
	
	/**
	 * 依据实体对象的信息构造一个停车记录表模型对象
	 * 
	 * @param entity 实体对象
	 */
	public Record(RecordEntity entity){
		super(entity);
	}

	/**
	 * 依据其它对象的信息构造一个停车记录表模型对象
	 * 
	 * @param other 其它对象
	 */
	public Record(Record other){
		super(other);
	}


	@Override
	public String getId() {
    	return id;
    }

    /**
	 * 设置
	 * 
	 * @param id 
	 * @return 当前对象
	 */
    public Record id(String id) {
    	this.id = id;
    	return this;
    }

	@Override
	public String getBusdId() {
    	return busdId;
    }

    /**
	 * 设置商圈ID
	 * 
	 * @param busdId 商圈ID
	 * @return 当前对象
	 */
    public Record busdId(String busdId) {
    	this.busdId = busdId;
    	return this;
    }

	@Override
	public String getThirdId() {
    	return thirdId;
    }

    /**
	 * 设置第三方ID
	 * 
	 * @param thirdId 第三方ID
	 * @return 当前对象
	 */
    public Record thirdId(String thirdId) {
    	this.thirdId = thirdId;
    	return this;
    }

	@Override
	public ParkSystem getParkSystem() {
    	return parkSystem;
    }

    /**
	 * 设置[全局枚举]停车系统：0-无忧停车-DAHANWUYOU、1-ETCP-ETCP、2-一点通停车系统-YDT、3-一路停停车系统-TLT、4-科拓停车系统-KT
	 * 
	 * @param parkSystem [全局枚举]停车系统：0-无忧停车-DAHANWUYOU、1-ETCP-ETCP、2-一点通停车系统-YDT、3-一路停停车系统-TLT、4-科拓停车系统-KT
	 * @return 当前对象
	 */
    public Record parkSystem(ParkSystem parkSystem) {
    	this.parkSystem = parkSystem;
    	return this;
    }

	@Override
	public String getPlateNumber() {
    	return plateNumber;
    }

    /**
	 * 设置
	 * 
	 * @param plateNumber 
	 * @return 当前对象
	 */
    public Record plateNumber(String plateNumber) {
    	this.plateNumber = plateNumber;
    	return this;
    }

	@Override
	public LocalDateTime getEntranceTime() {
    	return entranceTime;
    }

    /**
	 * 设置入场时间
	 * 
	 * @param entranceTime 入场时间
	 * @return 当前对象
	 */
    public Record entranceTime(LocalDateTime entranceTime) {
    	this.entranceTime = entranceTime;
    	return this;
    }

	@Override
	public BigDecimal getParkingFee() {
    	return parkingFee;
    }

    /**
	 * 设置总停车费
	 * 
	 * @param parkingFee 总停车费
	 * @return 当前对象
	 */
    public Record parkingFee(BigDecimal parkingFee) {
    	this.parkingFee = parkingFee;
    	return this;
    }

	@Override
	public BigDecimal getPaidFee() {
    	return paidFee;
    }

    /**
	 * 设置已缴停车费
	 * 
	 * @param paidFee 已缴停车费
	 * @return 当前对象
	 */
    public Record paidFee(BigDecimal paidFee) {
    	this.paidFee = paidFee;
    	return this;
    }

	@Override
	public BigDecimal getPaidServiceFee() {
    	return paidServiceFee;
    }

    /**
	 * 设置已缴服务费
	 * 
	 * @param paidServiceFee 已缴服务费
	 * @return 当前对象
	 */
    public Record paidServiceFee(BigDecimal paidServiceFee) {
    	this.paidServiceFee = paidServiceFee;
    	return this;
    }

	@Override
	public BigDecimal getRemainingFee() {
    	return remainingFee;
    }

    /**
	 * 设置剩余代缴总费
	 * 
	 * @param remainingFee 剩余代缴总费
	 * @return 当前对象
	 */
    public Record remainingFee(BigDecimal remainingFee) {
    	this.remainingFee = remainingFee;
    	return this;
    }

	@Override
	public BigDecimal getRemainingParkFee() {
    	return remainingParkFee;
    }

    /**
	 * 设置剩余代缴停车费
	 * 
	 * @param remainingParkFee 剩余代缴停车费
	 * @return 当前对象
	 */
    public Record remainingParkFee(BigDecimal remainingParkFee) {
    	this.remainingParkFee = remainingParkFee;
    	return this;
    }

	@Override
	public BigDecimal getRemainingServiceFee() {
    	return remainingServiceFee;
    }

    /**
	 * 设置剩余代缴服务费
	 * 
	 * @param remainingServiceFee 剩余代缴服务费
	 * @return 当前对象
	 */
    public Record remainingServiceFee(BigDecimal remainingServiceFee) {
    	this.remainingServiceFee = remainingServiceFee;
    	return this;
    }

	@Override
	public String getParkingId() {
    	return parkingId;
    }

    /**
	 * 设置停车场ID
	 * 
	 * @param parkingId 停车场ID
	 * @return 当前对象
	 */
    public Record parkingId(String parkingId) {
    	this.parkingId = parkingId;
    	return this;
    }

	@Override
	public BigDecimal getDiscountAmount() {
    	return discountAmount;
    }

    /**
	 * 设置优免金额
	 * 
	 * @param discountAmount 优免金额
	 * @return 当前对象
	 */
    public Record discountAmount(BigDecimal discountAmount) {
    	this.discountAmount = discountAmount;
    	return this;
    }

	@Override
	public String getVerificationInfo() {
    	return verificationInfo;
    }

    /**
	 * 设置停车费支付接口验证信息
	 * 
	 * @param verificationInfo 停车费支付接口验证信息
	 * @return 当前对象
	 */
    public Record verificationInfo(String verificationInfo) {
    	this.verificationInfo = verificationInfo;
    	return this;
    }

	@Override
	public String getOrderNo() {
    	return orderNo;
    }

    /**
	 * 设置订单号
	 * 
	 * @param orderNo 订单号
	 * @return 当前对象
	 */
    public Record orderNo(String orderNo) {
    	this.orderNo = orderNo;
    	return this;
    }

	@Override
	public RecordStatus getStatus() {
    	return status;
    }

    /**
	 * 设置[枚举]订单状态：0-未入场-NOTIN、1-已入场-IN、2-已出场-OUT
	 * 
	 * @param status [枚举]订单状态：0-未入场-NOTIN、1-已入场-IN、2-已出场-OUT
	 * @return 当前对象
	 */
    public Record status(RecordStatus status) {
    	this.status = status;
    	return this;
    }

	@Override
	public String getCouponId() {
    	return couponId;
    }

    /**
	 * 设置停车券ID
	 * 
	 * @param couponId 停车券ID
	 * @return 当前对象
	 */
    public Record couponId(String couponId) {
    	this.couponId = couponId;
    	return this;
    }

	@Override
	public BigDecimal getCouponDiscountFee() {
    	return couponDiscountFee;
    }

    /**
	 * 设置停车券抵扣金额
	 * 
	 * @param couponDiscountFee 停车券抵扣金额
	 * @return 当前对象
	 */
    public Record couponDiscountFee(BigDecimal couponDiscountFee) {
    	this.couponDiscountFee = couponDiscountFee;
    	return this;
    }

	@Override
	public BigDecimal getPayFee() {
    	return payFee;
    }

    /**
	 * 设置支付费用
	 * 
	 * @param payFee 支付费用
	 * @return 当前对象
	 */
    public Record payFee(BigDecimal payFee) {
    	this.payFee = payFee;
    	return this;
    }

	@Override
	public Boolean getPayStatus() {
    	return payStatus;
    }

    /**
	 * 设置支付状态：0-未支付；1-已支付
	 * 
	 * @param payStatus 支付状态：0-未支付；1-已支付
	 * @return 当前对象
	 */
    public Record payStatus(Boolean payStatus) {
    	this.payStatus = payStatus;
    	return this;
    }

	@Override
	public LocalDateTime getPayTime() {
    	return payTime;
    }

    /**
	 * 设置支付时间
	 * 
	 * @param payTime 支付时间
	 * @return 当前对象
	 */
    public Record payTime(LocalDateTime payTime) {
    	this.payTime = payTime;
    	return this;
    }

	@Override
	public LocalDateTime getFailureTime() {
    	return failureTime;
    }

    /**
	 * 设置
	 * 
	 * @param failureTime 
	 * @return 当前对象
	 */
    public Record failureTime(LocalDateTime failureTime) {
    	this.failureTime = failureTime;
    	return this;
    }

	@Override
	public LocalDateTime getCreatedTime() {
    	return createdTime;
    }

    /**
	 * 设置创建时间
	 * 
	 * @param createdTime 创建时间
	 * @return 当前对象
	 */
    public Record createdTime(LocalDateTime createdTime) {
    	this.createdTime = createdTime;
    	return this;
    }

	@Override
	public LocalDateTime getModifiedTime() {
    	return modifiedTime;
    }

    /**
	 * 设置修改时间
	 * 
	 * @param modifiedTime 修改时间
	 * @return 当前对象
	 */
    public Record modifiedTime(LocalDateTime modifiedTime) {
    	this.modifiedTime = modifiedTime;
    	return this;
    }

	public BigDecimal getIntegralFee() {
    	return integralFee;
    }

    /**
	 * 设置积分抵扣金额
	 * 
	 * @param integralFee 积分抵扣金额
	 * @return 当前对象
	 */
    public Record integralFee(BigDecimal integralFee) {
    	this.integralFee = integralFee;
    	return this;
    }

	public Integer getIntegral() {
    	return integral;
    }

    /**
	 * 设置抵扣积分
	 * 
	 * @param integral 抵扣积分
	 * @return 当前对象
	 */
    public Record integral(Integer integral) {
    	this.integral = integral;
    	return this;
    }

	public void setParking(Parking parking) {
		if (PrivateStringUtils.isEmpty(getParkingId())){
			setParkingId(parking.getId());
		}
		setParkingName(parking.getName());
	}
}
